﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
/**
 * 互联网数据验证类
 * bobo
 */
namespace RelationExtraction
{
    public class InternetVerify
    {
        /*
         * 通过搜搜Suggestion来获得校验
         * return 0 错误 1 正确
         */
        public static bool testBySosoSuggestion(string entity1, string entity2)
        {
            String baseUrl = "http://www.soso.com/smart_web.q?w=";
            String testStr = entity1 + " " + entity2;
            baseUrl += testStr;
            WebClient webClient = new WebClient();
            String HtmlString = Encoding.GetEncoding("GBK").GetString(webClient.DownloadData(baseUrl));
            String strInput = testStr + "\t0";
            if (HtmlString.Contains(strInput))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }

}
